#include "mainWidget.h"

#include <QApplication>
#include "debug.h"
#include "loginwidget.h"
#include "toast.h"
#include "model/datacenter.h"
FILE* output;
void msgHandler(QtMsgType type,const QMessageLogContext& context,const QString& log)
{
    (void)type;(void)context;
    const QByteArray& Log =log.toUtf8();
    fprintf(output,"%s\n",Log.constData());
    fflush(output);//刷新进磁盘
}
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
#if IS_DEPLOY
    output =fopen("./log.txt","a");
    qInstallMessageHandler(msgHandler);
#endif

#if SKIP_LOGIN
    MainWidget* w = MainWidget::getInstance();
    w->show();
#else
    LoginWidget* w = new LoginWidget;
    //Toast::showMessage("平平无奇的测试内容");
    w->show();
#endif

#if TEST_NETWORK
    model::DataCenter* dataCenter = model::DataCenter::getInstance();
    dataCenter->ping();
#endif
    return a.exec();
}
